import React from 'react';
import Edit from './edit';
import { Button, Table } from 'antd';
import { stateMap } from '@/utils/map';
import { PlusOutlined } from '@ant-design/icons';
import { FormItem } from '@/components/FormPro/types';
import { PageCard, SearchPro, ModalPro } from '@/components';

const formList: FormItem[] = [
  {
    name: 'name',
    type: 'input',
    label: '应用名称'
  },
  {
    name: 'state',
    type: 'select',
    label: '应用状态',
    width: 160,
    group: stateMap
  }
];

class OwnApp extends React.PureComponent {
  get header() {
    return (
      <SearchPro formList={formList}>
        <ModalPro
          okText="新建"
          width="484px"
          title="新建应用"
          cancelText="取消"
          triggerContent={<Edit />}
        >
          <Button icon={<PlusOutlined/>} type="primary">新建</Button>
        </ModalPro>
      </SearchPro>
    )
  }
  render() {
    return (
      <PageCard header={this.header}>
        <Table />
      </PageCard>
    )
  }
}

export default OwnApp;
